package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016092000557778";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCca+QlxeEFitqErlCjeXEu6Phtsvo+ZSTy7D9FmUkd6G5Vfj3LojUYcmUTgomYAh6yJA60ppgYda6ywtoPZKH6xCxxX9lsldEs9lHGA/bLpTV7e5B2fJn4QKEUDOx0CdCV/80/B4kdhX406ScECOXk7oKRmHlHHGHdkywelOCctvYss6EToFzkKzTic1FjADqifXcnhUDn8PQCOr65C7+JEpkZiKWMzKzF+ou58yxFZPowE1Hemu39b3C87ereJwPbI0moRhsv6y8l6CspDRVJs1RKMfYzyk4mJamxOE7CxlREGrKByJwxwXdImdIEE0JQgFmAIzDsmGxEpdfHVDDJAgMBAAECggEALlp2oI70MO1F9j2l3dvWI52cSP3Z1HWqrmY+FcTn+vnvAFzJuTeXXmg/9bkgRzCRoh63UOdxeQYewBCoCBm9Oo+5z9skll4LP7S65OA12YFayP4EAGjKQ9v7H/L4eyaRbnIAg6YbBumRTeKt0i9E2UOo47Z4cg9CHSRI1cMukKHc1XXlUV4+0gnemq1yzAcpBQidzJcyKMkfMruWBzMh0WG6UQmUqHAHn5cQXmWpeKI96NtFPNKaHCh8tOyPH565lA01acgsTIa0bUoIdUvIVpz3ivLXuYPy6PRQKSv/9wCBtumg76z6wOT/VFNAupdwiq2Spk1ZnUWWo9o0OaC4AQKBgQDJDRHOQ44WvBWXE04zSS0brOxDleZebOqTMFyJLoLWpEJyV2e01tLTKKDNMMmEEg6wK7k9X2UUseaKiyFrLRcGpzj5uqAel2K1WS4F1+v6A5yXGIqyOpjrlWlx8usWogodd03nKUELFXLjXCLHNYO+cJYUA/U9VIYyqjfFBTG7AQKBgQDHLDlgFvsjSZietiOHj4YZpP4prg2t7P1Ieaw25tSPCot6rO8ayUqIq+F9MECbonLYtOQJm5Dr4mCQtNVsD9cYOmCILKK0Exh8Rybe+btqTjRlRhRtPYR57KkrNuXmZuGqr+ogGXuofxR7yK61GiRH77SGk9cqOT1y27vUn1ldyQKBgQCj8+iFUEna+F6S6Mdow0/ptcamBuPqNN/GUDXmGOvRpfoZzHVh353lXMhlDFgJP8CCoeVZyyVfDwR2DqeeAxM39b5cyHgy+jkgsiz5zu883x0fin/wgCCcXSe0KOjVeCbPiK8ax2WnaEJcbpJd6aIZ9y4r/F5NOVSGlJEONgIsAQKBgAHdsjPqQzQTbnCeODr+5zy6RP9S+CHXBJB3Q1vIUdl9Oc1ObXcMx7v8EELB/vj2TqklGLXWVUdAebMhXpaCl3tMoLbl5ChXvXT8naqdIFpgnTENtQdI+kLCKtuSyhicgiS9PS5LztLHTgPS34Am3Iwn/ML+A5gLrT20PVBCpe2xAoGBAJNXgLA07SG88BrWC3492IENpyopjqfwpfKJkB/DArHetv4xrbmmfvGsNgMuwrIpralfZu/sBedFJCnYnoNijcg7qlvM8/Ep3Kcu4ymv6FH7dsO56+nqIp153ZaiTHsrOZ5Nr3EtS1l2n66vSfcDPkgLhdGaT7o3I7frdv7reFwq";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqpBEU11FLZtqkKT1eu5Ke+hrbNiNoLD06RQkfzIvAzWE3Kj+MslVRauJGM44Nfl+fhM06krJZrkU4p717E+Sy1Y2BVZ1TBNMPC8Lv3Zj+SypsGoi7L6dyc/KIGD8H9OYEL4MZjiMJ+tw3bGM/VyS7dBo7joY44j0aMhEU7i6Xy0y1v52IBhGbf/Wkf3bsLrEmisB+qeu1yUGbdIJQK5pg6ENujL1dJrXxFUu39UkDWtsjucE5FyCF++iI3maxKAVMs7nwg8Hph4XLYdG6TLIkRzxE1lCnv/MGBg3ffVgns4Chs8pIN9JsgKfARaYp8csg2cpYCFv/R1l5PKbWSLjUwIDAQAB\n";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://nut.nat300.top/alibaba/callBack/notifyUrl";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://nut.nat300.top/alibaba/callBack/returnUrl";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

